home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / Source / MSG Demo 1.4.source Folder / Demo ƒ / Fades ƒ / Skipaline L-R 2-pass fade.c < prev    next >
Text File  |  1994-04-15  |  2KB  |  70 lines

  1. /**********************************************************************\
  2.  
  3. File:        Skipaline L-R 2-pass fade.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 1
  28. #define theWindowWidth (boundsRect.right-boundsRect.left)
  29. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  30.  
  31. pascal short SkipalineLR2PassFade(Rect boundsRect, Pattern *thePattern);
  32.  
  33. /* Copy even-numbered columns starting at the left and moving right, and odd-
  34.    numbered columns starting at the right and moving left.  */
  35.    
  36. pascal short SkipalineLR2PassFade(Rect boundsRect, Pattern *thePattern)
  37. {
  38.     Rect        thisone,thatone;
  39.     Boolean        everyOther=FALSE;
  40.     
  41.     SetRect(&thisone, boundsRect.left, boundsRect.top, boundsRect.left+1, boundsRect.bottom);
  42.     SetRect(&thatone, boundsRect.right-1, boundsRect.top, boundsRect.right, boundsRect.bottom);
  43.     if (theWindowWidth%2)
  44.         OffsetRect(&thatone, -1, 0);
  45.     
  46.     while (thisone.left<boundsRect.right)
  47.     {
  48.         StartTiming();
  49.         FillRect(&thisone, *thePattern);
  50.         thisone.left+=2;      /* left column moves right by 2 */
  51.         thisone.right+=2;
  52.         if (everyOther)
  53.             TimeCorrection(CorrectTime);
  54.         everyOther=!everyOther;
  55.     }
  56.     
  57.     while (thatone.right>=boundsRect.left)
  58.     {
  59.         StartTiming();
  60.         FillRect(&thatone, *thePattern);
  61.         thatone.left-=2;      /* right column moves left by 2 */
  62.         thatone.right-=2;
  63.         if (everyOther)
  64.             TimeCorrection(CorrectTime);
  65.         everyOther=!everyOther;
  66.     }
  67.     
  68.     return 0;
  69. }
  70.